<!DOCTYPE html>
<head>
    <title>前端路由的基石 - history</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/history/4.9.0/history.js"></script>
    <script>
        function push(path) {
            history.push(path);
            return false;
        }

        history.listen(location => {
            console.log("history发生了变化 ", location);
        });

        
    </script>
</head>
<body>
    <a href="http://www.baidu.com" onclick="push('/test1')">push test</a>

    操作的就是 window.history对象 <br />
    参考优秀教程: https://www.bilibili.com/video/BV1wy4y1D7JT?p=76
    
</body>
</html>